const reg = /\<block\>([.\n\s\S]*?)\<block\>/;
export function render(str) {
  const com = str.match(reg)[1];
  appendScript(com);
}

function appendScript(code) {
  const script = document.createElement("script"); //创建一个script标签
  script.type = "text/javascript";
  try {
    //IE浏览器认为script是特殊元素,不能再访问子节点;报错;
    script.appendChild(document.createTextNode(code));
  } catch (ex) {
    script.text = code;
  }
  document.getElementsByTagName("html")[0].appendChild(script);
}
